﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CE.User;

public partial class travel_hotels_default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
            if (TextBox1.Text == CE.Configuration.MyConfigurationManager.GetAppSettingValue("CXHotelID"))
            {
                if (TextBox2.Text == CE.Configuration.MyConfigurationManager.GetAppSettingValue("CXHotelPass"))
                {
                    Session[CE.Global.General.Guest] = "Admin";
                    LogUserViewedHistory("Security page [admin=" + TextBox1.Text + ";password=" + TextBox2.Text + "] login passed.");
                    Response.Redirect("hotels-search.aspx");
                }
                else
                {
                    LogUserViewedHistory("Security page [user=" + TextBox1.Text + ";password=" + TextBox2.Text + "] login failed.");
                }
            }
            
        }
        else
        {
            LogUserViewedHistory("Security page [userid=" + TextBox1.Text + ";password=" + TextBox2.Text + "] invalid login.");
        }

    }

    private void LogUserViewedHistory(string Description)
    {
        UserViewHistoryDB _userviewdb = new UserViewHistoryDB();
        _userviewdb.LogViewedHistory("HOT", Request, Description);
    }
}
